<?php 
include "includes/session.php";
include "includes/comunes.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="refresh" CONTENT="300"/>
<title>Sistema de Registro de Atencion</title>

<link href="estilos.css" rel="stylesheet" type="text/css" />

<!--libreria jquery central-->

<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->

<!--Librerias para el combo-->
<script language="JavaScript" type="text/javascript" src="combos/jquery.chainedSelects.js"></script>
<!--fin libreria-->

<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<!--fin libreria-->
<!--libreria flexigrid-->
<link rel="stylesheet" type="text/css" href="jquery-ui/css/ui-flexigrid/flexigrid.css">
    <script type="text/javascript" src="jquery-ui/js/flexigrid.js"></script>
<!--fin libreria-->
<!--VENTANA MODAL -->
<link href="modal/styles/modal-window.css" type="text/css" rel="stylesheet" /> 
 
		<script type="text/javascript" language="javascript" src="modal/scripts/modal-window.min.js"></script>  
<!--
  fin estilo scroll-->


<script language="JavaScript" type="text/javascript">
$(function()
{

//        funcion que implementa combos
	$('#rubro').chainSelect('#subrubro','comborubrosubrubro.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
	
	
	
	$('#marca').chainSelect('#modelo','combomarcamodelo.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
    $( "#menu" ).menu({position: {at: "left bottom"}});
           
		$("#codigo").autocomplete({
			source: "autoArticulos.php"
		});   
		
	
	$('#tipo').change(function(){
    var $selectedOption = $(this).find('option:selected');
	var selectedValue = $selectedOption.val();
	if (selectedValue==3)
	 {
		  $('#cubiertas').show("swing");
		  
		 
	  }else
	  {
	     $('#cubiertas').hide("swing");
	  }
	});	
		

});
</script>

</head>

<body>

<div class="container">
<?php include "includes/head.php"?>
   <div class="content">
       <div class="tituloprincipal">
          <?php include 'includes/submenu.php';?>  
           <img src="img/nuevo.png" width="25" height="25" border="0"/> Nuevo Producto
           </div>
       <form id="pedido" name="pedido" method="POST" action="grabarProducto.php">
       <div class="contenedorpedido">
           <div id="vendedor">
           <fieldset>
              <legend><b>Datos del Producto</b></legend> 
               <table  width="100%">
                 <tr>
                      <td class="textotablamenuform">Codigo</td>
                      <td class="textotablamenuform">
                          <input type="text" class="campo_form"  id="codigo" name="codigo" required>
                      </td>
                      <td class="textotablamenuform"></td>
                      <td class="textotablamenuform">
                      </td>
                      
                 </tr>
                   <tr>
                      <td class="textotablamenuform">Descripcion</td>
                      <td class="textotablamenuform" colspan="5">
                           <input type="text" class="campo_form"  id="nombre" name="nombre" required>
                               
                      </td> 
                   </tr>
                   
                   <tr>
                      <td class="textotablamenuform">Costo</td>
                      <td class="textotablamenuform">
                          <input type="number" step="0.1" class="campo_form" required id="costo" name="costo">
                    
                      </td>
                     <!-- <td class="textotablamenuform">Precio</td>
                      <td class="textotablamenuform">
                          <input type="number" class="campo_form" step="0.1" required id="precio" name="precio">
                          
                      </td>-->
                      <td class="textotablamenuform">Stock Minimo</td>
                      <td class="textotablamenuform" >
                           <input type="number" class="campo_form"  value="0" required id="stock" name="stock" >
                    
                      </td>
                 </tr>
                   <tr>
				    <td class="textotablamenuform">Marca</td>
                      <td class="textotablamenuform" >
                           <select class="campo_form" name="marca" id="marca" required>
						   
						   <?php 
						   $resRub=obtener_stock_marcas();
						   while($regRub=mysql_fetch_array($resRub)):?>
						   <option value="<?php echo $regRub['id']?>"><?php echo utf8_encode($regRub['Nombre'])?></option>
						   <?php endwhile ?>
						  </select>
                    
                      </td>
					  
					   <td class="textotablamenuform">Tipo</td>
                      <td class="textotablamenuform" >
                           <select class="campo_form" name="tipo" id="tipo" required>
						     <option value="1" selected>Otros</option>
							 <option value="2">Combustible</option>
							 <option value="3">Cubiertas</option>
							 
						  </select>
                    
                      </td>
					  
					  
                    
                    
                      
                     
                 </tr>
				 <tr id="cubiertas" style="display:none;">
				 
				 
				   <td class="textotablamenuform">Modelo</td>
                      <td class="textotablamenuform" >
                           <select class="campo_form" name="modelo" id="modelo" required>
						     <option value="0" selected>Seleccionar</option>
							<?php 
						   $resRub=obtener_modelos_cubiertas();
						   while($regRub=mysql_fetch_array($resRub)):?>
						   <option value="<?php echo $regRub['ModId']?>"><?php echo utf8_encode($regRub['ModNombre'])?></option>
						   <?php endwhile ?>
						  </select>
							 
						  
                    
                      </td>
					  <td class="textotablamenuform">Dimension</td>
                      <td class="textotablamenuform" >
                           <select class="campo_form" name="dimension" id="dimension" required>
						     <option value="1" selected>Seleccionar</option>
							 <?php 
						   $resRub=obtener_dimensiones_cubiertas();
						   while($regRub=mysql_fetch_array($resRub)):?>
						   <option value="<?php echo $regRub['DimId']?>"><?php echo utf8_encode($regRub['DimNombre'])?></option>
						   <?php endwhile ?>
						  </select>
							 
						  </select>
                    
                      </td> 
					  <td class="textotablamenuform">Talon</td>
                      <td class="textotablamenuform" >
                           <select class="campo_form" name="talon" id="talon" required>
						     <option value="0" selected>Seleccionar</option>
							 <option value="1">Con Talon</option>
							 <option value="2">Sin Talon</option>
							 
						  </select>
                    
                      </td> 
					  <td class="textotablamenuform">Km Inicial</td>
                      <td class="textotablamenuform" >
                             <input type="number" class="campo_form"  id="km" name="km">
                    
                      </td> 
					  
                    
                    
                      
                     
                 </tr>
				 <tr>
				 <td class="textotablamenuform">Proveedor</td>
				  <td class="textotablamenuform" colspan="3">
                           <select class="campo_form" name="proveedor" id="proveedor" required>
						  
						   <?php 
						   $resRub=obtener_prov_vehiculos();
						   while($regRub=mysql_fetch_array($resRub)):?>
						   <option value="<?php echo $regRub['ProveedorId']?>"><?php echo utf8_encode($regRub['ProveedorNombre'])?></option>
						   <?php endwhile ?>
						  </select>
                    
                      </td>
				 </tr>
				 <tr>
                      
                      <td class="textotablamenuform">Rubro</td>
                      <td class="textotablamenuform" >
                           <select class="campo_form" name="rubro" id="rubro" required>
						   <option value=0>Seleccionar..</option>
						   <?php 
						   $resRub=stock_rubros();
						   while($regRub=mysql_fetch_array($resRub)):?>
						   <option value="<?php echo $regRub['id']?>"><?php echo utf8_encode($regRub['Nombre'])?></option>
						   <?php endwhile ?>
						  </select>
                    
                      </td>
                       <td class="textotablamenuform">Sub Rubro</td>
                      <td class="textotablamenuform">
                          <select class="campo_form" name="subrubro" id="subrubro"  style="display:none:">
						  </select>
						  
                     <input type="hidden" class="campo_form"   value="1" id="subrubro" name="subrubro" >
                      </td>
                       <td class="textotablamenuform" colspan="3"></td>
                 </tr>
				 <tr>
				 <td class="textotablamenuform">
				 Observacion
				 </td>
				 <td colspan="4">
				 <textarea name="venObse" cols="65" class="campo_form"></textarea>
				 </td>
				 </tr>
                   
                   
                   
               </table>    
           </fieldset>  
           </div>
           
        
           <fieldset style="text-align: right;">  
            <table style="text-align: right;">
             <tr>
                    <td class="textotablamenuform" style="text-align: right;" colspan="5">
                         <input type="reset" name="enviar" value="Limpiar"  class="boton_form"/>
                         <input name="submit" id="submit" type="submit" value="Grabar Articulo" class="boton_form"/>
                     </td>
                 </tr>
                   </table>       
           </fieldset>  
           
           
           
       </div>
   </form>
       <div class="clear"></div>
   <br>
   </div>
  <?php include "includes/pie.php"?>
  
</div>
</body>
</html>
